<!-- 登录弹窗 -->
<style>
    .login_shadow{width: 100%;height: 100%;position: fixed;top: 0;z-index: 9999; display:none;}
    .login_box{width: 300px;height: 150px;margin: 0 auto;margin-top: 200px;background-color:#a1a1bb;position: relative;padding:50px 10px 10px 10px;font-size: 20px;}
    .close_btn{
        position: absolute;
        right:5px;
        top:5px;
        background-color: #6d6767;
    }
    .login_line{
        overflow: hidden;
    }
    .login_item{
        float:left;
    }
    .item_name{
        width:90px;
        text-align: center;
    }
    .item_input{
        width:210px;
    }
    .login_line input{
        font-size: 20px;
        width:100%;
    }
    .login_button div{
        width: 100px;
        margin: 0 auto;
    }
    .login_line button{
        font-size: 20px;
        width: 100px;
        margin-top:10px;
    }
</style>
<div class="login_shadow" >
    <div class="login_box">
        <div class="close_btn" onclick="close_login()">关闭</div>
        <div class="login_line">
               <div class="login_item item_name">
                    用户名
               </div>
               <div class="login_item item_input">
                    <input placeholder="输入用户名" id="username" type="text">
               </div>
        </div>
        <div class="login_line">
               <div class="login_item item_name">
                    密码
               </div>
               <div class="login_item item_input">
                    <input placeholder="输入密码" id="password" type="text">
               </div>
        </div>
        <!-- 验证码 -->
            <!-- 懒得写 -->
        <!-- 验证码 -->
        <div class="login_line login_button">
                <div>
                    <button onclick="login()">提交</button>
                </div>
        </div>
    </div>
</div>
<script>
    //登录
    function login(){
        //验证表单
        if($("#username").val()==""){
            alert("请输入用户名");
            return false;
        }
        //验证表单
        if($("#password").val()==""){
            alert("请输入密码");
            return false;
        }
        //发出请求
        $.post(
            "/controler.php",
            {
                handle:"login",
                username:$("#username").val(),
                password:$("#password").val(),
            },
            function(msg){
                if(msg=="done"){
                    $(".login_shadow").css("display","none");
                    $(".login_first").css("display","none");
                    $(".login-tip").css("display","none");
                    $(".login_ed").css("display","block");
                    $(".wantcomment").css("display","block");
                    $("#login_user_name").html($("#username").val());
                }
                else if(msg=="no"){
                    alert("没有找到该用户");
                }
                else{
                    alert("系统出错");
                }
            }
        )
    }
</script>